/*
 * send_struct.cpp
 *
 *  Created on: 2008-8-15
 *      Author: root
 */

/*
 Sender:
 #pragma pack(1) // should be defined beform "struct member personalInfo"
 struct member personalInfo;
 personalInfo.age = htonl(personalInfo.age);
 ret = send(socket_fd, (void *)&personalInfo, sizeof(struct member), 0);
 .....

 Receiver:
 #pragma pack(1) // should be defined beform "struct member personalInfo"
 and the value be the same as send's
 struct member personalInfo;
 ret = recv(socket_fd, (void *)&personalInfo, sizeof(struct member), 0);
 personalInfo.age = ntohl(personalInfo.age);
 */

#include <stdio.h>
#include <endian.h>

// change the 1 with other numbers to check out the differences
#pragma pack(1)

int main(void)

{
	printf("big:%d little:%d mine:%d\n", __BIG_ENDIAN, __LITTLE_ENDIAN,
			__BYTE_ORDER);

	struct member
	{
		char name[32];
		int age;
		char gender;
		char address[128];
	};

	printf("size is:%d\n", sizeof(struct member));
	return 0;
}
